import request from "@/utils/request";

const LOG_BASE_URL = "/v3/data/location";

class LocationApi {
  static trajectory(queryParams: trajectoryReq) {
    return request<any, trajectoryData[]>({
      url: `${LOG_BASE_URL}/trajectory`,
      method: "post",
      headers: {
        "Content-Type": "application/json",
      },
      data: queryParams,
    });
  }
  static getDeviceLocationInfo(deviceId: string) {
    return request<any, DeviceLocationInfoReq>({
      url: `${LOG_BASE_URL}/getDeviceLocationInfo`,
      method: "post",
      params: {
        deviceId,
      },
    });
  }
}

export default LocationApi;

/**
 *
 */
export interface Locations {
  x?: string;
  y?: string;
}
export interface trajectoryReq {
  deviceId?: string;
  startTime?: number;
  endTime?: number;
}

export interface DeviceLocationInfoReq {
  basicInfo: basicInfo;
  locationInfo: locationInfo;
}
export interface basicInfo {
  id: string;
  deviceName: string;
  deviceCode: string;
  deviceTypeId: string;
  module: string;
  softVer: string;
  hardVer: string;
  imei: string;
  iccid: string;
}
export interface locationInfo {
  location: any;
  speed: number;
  start: number;
  country: string;
  province: string;
  city: string;
  district: string;
  formattedAddress: string;
  pdop: number;
  gps: number;
}
export interface trajectoryData {
  city: string;
  country: string;
  district: string;
  formattedAddress: string;
  gps: number;
  id: string;
  lat: number;
  lng: number;
  originTime: string;
  pdop: number;
  province: string;
  speed: number;
  start: number;
}
